home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Modules / errnomodule.c < prev    next >
C/C++ Source or Header  |  1999-04-25  |  25KB  |  831 lines

  1. /***********************************************************
  2. Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
  3. The Netherlands.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its
  8. documentation for any purpose and without fee is hereby granted,
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in
  11. supporting documentation, and that the names of Stichting Mathematisch
  12. Centrum or CWI or Corporation for National Research Initiatives or
  13. CNRI not be used in advertising or publicity pertaining to
  14. distribution of the software without specific, written prior
  15. permission.
  16.  
  17. While CWI is the initial source for this software, a modified version
  18. is made available by the Corporation for National Research Initiatives
  19. (CNRI) at the Internet address ftp://ftp.python.org.
  20.  
  21. STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
  22. REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  23. MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
  24. CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  25. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  26. PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  27. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  28. PERFORMANCE OF THIS SOFTWARE.
  29.  
  30. ******************************************************************/
  31.  
  32. /* Errno module */
  33.  
  34. #include "Python.h"
  35.  
  36. /* Mac with GUSI has more errors than those in errno.h */
  37. #ifdef USE_GUSI
  38. #include <sys/errno.h>
  39. #endif
  40.  
  41. /* Windows socket errors (WSA*): XXX is this the correct path ???  */
  42. #ifdef MS_WINDOWS
  43. #include <winsock.h>
  44. #endif
  45.  
  46. #include "protos/errnomodule.h"
  47.  
  48. /*
  49.  * Pull in the system error definitions
  50.  */ 
  51.  
  52. static PyMethodDef errno_methods[] = {
  53.     {NULL,              NULL}
  54. };
  55.  
  56. /* Helper function doing the dictionary inserting */
  57.  
  58. static void
  59. _inscode(d, de, name, code)
  60.     PyObject *d;
  61.     PyObject *de;
  62.     char *name;
  63.     int code;
  64. {
  65.     PyObject *u;
  66.     PyObject *v;
  67.  
  68.     u = PyString_FromString(name);
  69.     v = PyInt_FromLong((long) code);
  70.  
  71.     if (!u || !v) {
  72.         /* Don't bother reporting this error */
  73.         PyErr_Clear();
  74.     }
  75.     else {
  76.         /* insert in modules dict */
  77.         PyDict_SetItem(d, u, v);
  78.         /* insert in errorcode dict */
  79.         PyDict_SetItem(de, v, u);
  80.     }
  81.     Py_XDECREF(u);
  82.     Py_XDECREF(v);
  83. }
  84.  
  85. static char errno__doc__ [] =
  86. "This module makes available standard errno system symbols.\n\
  87. \n\
  88. The value of each symbol is the corresponding integer value,\n\
  89. e.g., on most systems, errno.ENOENT equals the integer 2.\n\
  90. \n\
  91. The dictionary errno.errorcode maps numeric codes to symbol names,\n\
  92. e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
  93. \n\
  94. Symbols that are not relevant to the underlying system are not defined.\n\
  95. \n\
  96. To map error codes to error messages, use the function os.strerror(),\n\
  97. e.g. os.strerror(2) could return 'No such file or directory'.";
  98.  
  99. DL_EXPORT(void)
  100. initerrno()
  101. {
  102.     PyObject *m, *d, *de;
  103.     m = Py_InitModule3("errno", errno_methods, errno__doc__);
  104.     d = PyModule_GetDict(m);
  105.     de = PyDict_New();
  106.     if (de == NULL || PyDict_SetItemString(d, "errorcode", de))
  107.         Py_FatalError("can't initialize errno module");
  108.  
  109. /* Macro so I don't have to edit each and every line below... */
  110. #define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)
  111.  
  112.     /*
  113.      * The names and comments are borrowed from linux/include/errno.h,
  114.      * which should be pretty all-inclusive
  115.      */ 
  116.  
  117. #ifdef ENODEV
  118.     inscode(d, ds, de, "ENODEV", ENODEV, "No such device");
  119. #endif
  120. #ifdef ENOCSI
  121.     inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
  122. #endif
  123. #ifdef EHOSTUNREACH
  124.     inscode(d, ds, de, "EHOSTUNREACH", EHOSTUNREACH, "No route to host");
  125. #else
  126. #ifdef WSAEHOSTUNREACH
  127.     inscode(d, ds, de, "EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
  128. #endif
  129. #endif
  130. #ifdef ENOMSG
  131.     inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
  132. #endif
  133. #ifdef EUCLEAN
  134.     inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
  135. #endif
  136. #ifdef EL2NSYNC
  137.     inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
  138. #endif
  139. #ifdef EL2HLT
  140.     inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
  141. #endif
  142. #ifdef ENODATA
  143.     inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
  144. #endif
  145. #ifdef ENOTBLK
  146.     inscode(d, ds, de, "ENOTBLK", ENOTBLK, "Block device required");
  147. #endif
  148. #ifdef ENOSYS
  149.     inscode(d, ds, de, "ENOSYS", ENOSYS, "Function not implemented");
  150. #endif
  151. #ifdef EPIPE
  152.     inscode(d, ds, de, "EPIPE", EPIPE, "Broken pipe");
  153. #endif
  154. #ifdef EINVAL
  155.     inscode(d, ds, de, "EINVAL", EINVAL, "Invalid argument");
  156. #else
  157. #ifdef WSAEINVAL
  158.     inscode(d, ds, de, "EINVAL", WSAEINVAL, "Invalid argument");
  159. #endif
  160. #endif
  161. #ifdef EOVERFLOW
  162.     inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
  163. #endif
  164. #ifdef EADV
  165.     inscode(d, ds, de, "EADV", EADV, "Advertise error");
  166. #endif
  167. #ifdef EINTR
  168.     inscode(d, ds, de, "EINTR", EINTR, "Interrupted system call");
  169. #else
  170. #ifdef WSAEINTR
  171.     inscode(d, ds, de, "EINTR", WSAEINTR, "Interrupted system call");
  172. #endif
  173. #endif
  174. #ifdef EUSERS
  175.     inscode(d, ds, de, "EUSERS", EUSERS, "Too many users");
  176. #else
  177. #ifdef WSAEUSERS
  178.     inscode(d, ds, de, "EUSERS", WSAEUSERS, "Too many users");
  179. #endif
  180. #endif
  181. #ifdef ENOTEMPTY
  182.     inscode(d, ds, de, "ENOTEMPTY", ENOTEMPTY, "Directory not empty");
  183. #else
  184. #ifdef WSAENOTEMPTY
  185.     inscode(d, ds, de, "ENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
  186. #endif
  187. #endif
  188. #ifdef ENOBUFS
  189.     inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available");
  190. #else
  191. #ifdef WSAENOBUFS
  192.     inscode(d, ds, de, "ENOBUFS", WSAENOBUFS, "No buffer space available");
  193. #endif
  194. #endif
  195. #ifdef EPROTO
  196.     inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
  197. #endif
  198. #ifdef EREMOTE
  199.     inscode(d, ds, de, "EREMOTE", EREMOTE, "Object is remote");
  200. #else
  201. #ifdef WSAEREMOTE
  202.     inscode(d, ds, de, "EREMOTE", WSAEREMOTE, "Object is remote");
  203. #endif
  204. #endif
  205. #ifdef ENAVAIL
  206.     inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
  207. #endif
  208. #ifdef ECHILD
  209.     inscode(d, ds, de, "ECHILD", ECHILD, "No child processes");
  210. #endif
  211. #ifdef ELOOP
  212.     inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered");
  213. #else
  214. #ifdef WSAELOOP
  215.     inscode(d, ds, de, "ELOOP", WSAELOOP, "Too many symbolic links encountered");
  216. #endif
  217. #endif
  218. #ifdef EXDEV
  219.     inscode(d, ds, de, "EXDEV", EXDEV, "Cross-device link");
  220. #endif
  221. #ifdef E2BIG
  222.     inscode(d, ds, de, "E2BIG", E2BIG, "Arg list too long");
  223. #endif
  224. #ifdef ESRCH
  225.     inscode(d, ds, de, "ESRCH", ESRCH, "No such process");
  226. #endif
  227. #ifdef EMSGSIZE
  228.     inscode(d, ds, de, "EMSGSIZE", EMSGSIZE, "Message too long");
  229. #else
  230. #ifdef WSAEMSGSIZE
  231.     inscode(d, ds, de, "EMSGSIZE", WSAEMSGSIZE, "Message too long");
  232. #endif
  233. #endif
  234. #ifdef EAFNOSUPPORT
  235.     inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
  236. #else
  237. #ifdef WSAEAFNOSUPPORT
  238.     inscode(d, ds, de, "EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
  239. #endif
  240. #endif
  241. #ifdef EBADR
  242.     inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
  243. #endif
  244. #ifdef EHOSTDOWN
  245.     inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down");
  246. #else
  247. #ifdef WSAEHOSTDOWN
  248.     inscode(d, ds, de, "EHOSTDOWN", WSAEHOSTDOWN, "Host is down");
  249. #endif
  250. #endif
  251. #ifdef EPFNOSUPPORT
  252.     inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
  253. #else
  254. #ifdef WSAEPFNOSUPPORT
  255.     inscode(d, ds, de, "EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
  256. #endif
  257. #endif
  258. #ifdef ENOPROTOOPT
  259.     inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
  260. #else
  261. #ifdef WSAENOPROTOOPT
  262.     inscode(d, ds, de, "ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
  263. #endif
  264. #endif
  265. #ifdef EBUSY
  266.     inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy");
  267. #endif
  268. #ifdef EWOULDBLOCK
  269.     inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
  270. #else
  271. #ifdef WSAEWOULDBLOCK
  272.     inscode(d, ds, de, "EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
  273. #endif
  274. #endif
  275. #ifdef EBADFD
  276.     inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state");
  277. #endif
  278. #ifdef EDOTDOT
  279.     inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
  280. #endif
  281. #ifdef EISCONN
  282.     inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected");
  283. #else
  284. #ifdef WSAEISCONN
  285.     inscode(d, ds, de, "EISCONN", WSAEISCONN, "Transport endpoint is already connected");
  286. #endif
  287. #endif
  288. #ifdef ENOANO
  289.     inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
  290. #endif
  291. #ifdef ESHUTDOWN
  292.     inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
  293. #else
  294. #ifdef WSAESHUTDOWN
  295.     inscode(d, ds, de, "ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
  296. #endif
  297. #endif
  298. #ifdef ECHRNG
  299.     inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
  300. #endif
  301. #ifdef ELIBBAD
  302.     inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
  303. #endif
  304. #ifdef ENONET
  305.     inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network");
  306. #endif
  307. #ifdef EBADE
  308.     inscode(d, ds, de, "EBADE", EBADE, "Invalid exchange");
  309. #endif
  310. #ifdef EBADF
  311.     inscode(d, ds, de, "EBADF", EBADF, "Bad file number");
  312. #else
  313. #ifdef WSAEBADF
  314.     inscode(d, ds, de, "EBADF", WSAEBADF, "Bad file number");
  315. #endif
  316. #endif
  317. #ifdef EMULTIHOP
  318.     inscode(d, ds, de, "EMULTIHOP", EMULTIHOP, "Multihop attempted");
  319. #endif
  320. #ifdef EIO
  321.     inscode(d, ds, de, "EIO", EIO, "I/O error");
  322. #endif
  323. #ifdef EUNATCH
  324.     inscode(d, ds, de, "EUNATCH", EUNATCH, "Protocol driver not attached");
  325. #endif
  326. #ifdef EPROTOTYPE
  327.     inscode(d, ds, de, "EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket");
  328. #else
  329. #ifdef WSAEPROTOTYPE
  330.     inscode(d, ds, de, "EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
  331. #endif
  332. #endif
  333. #ifdef ENOSPC
  334.     inscode(d, ds, de, "ENOSPC", ENOSPC, "No space left on device");
  335. #endif
  336. #ifdef ENOEXEC
  337.     inscode(d, ds, de, "ENOEXEC", ENOEXEC, "Exec format error");
  338. #endif
  339. #ifdef EALREADY
  340.     inscode(d, ds, de, "EALREADY", EALREADY, "Operation already in progress");
  341. #else
  342. #ifdef WSAEALREADY
  343.     inscode(d, ds, de, "EALREADY", WSAEALREADY, "Operation already in progress");
  344. #endif
  345. #endif
  346. #ifdef ENETDOWN
  347.     inscode(d, ds, de, "ENETDOWN", ENETDOWN, "Network is down");
  348. #else
  349. #ifdef WSAENETDOWN
  350.     inscode(d, ds, de, "ENETDOWN", WSAENETDOWN, "Network is down");
  351. #endif
  352. #endif
  353. #ifdef ENOTNAM
  354.     inscode(d, ds, de, "ENOTNAM", ENOTNAM, "Not a XENIX named type file");
  355. #endif
  356. #ifdef EACCES
  357.     inscode(d, ds, de, "EACCES", EACCES, "Permission denied");
  358. #else
  359. #ifdef WSAEACCES
  360.     inscode(d, ds, de, "EACCES", WSAEACCES, "Permission denied");
  361. #endif
  362. #endif
  363. #ifdef ELNRNG
  364.     inscode(d, ds, de, "ELNRNG", ELNRNG, "Link number out of range");
  365. #endif
  366. #ifdef EILSEQ
  367.     inscode(d, ds, de, "EILSEQ", EILSEQ, "Illegal byte sequence");
  368. #endif
  369. #ifdef ENOTDIR
  370.     inscode(d, ds, de, "ENOTDIR", ENOTDIR, "Not a directory");
  371. #endif
  372. #ifdef ENOTUNIQ
  373.     inscode(d, ds, de, "ENOTUNIQ", ENOTUNIQ, "Name not unique on network");
  374. #endif
  375. #ifdef EPERM
  376.     inscode(d, ds, de, "EPERM", EPERM, "Operation not permitted");
  377. #endif
  378. #ifdef EDOM
  379.     inscode(d, ds, de, "EDOM", EDOM, "Math argument out of domain of func");
  380. #endif
  381. #ifdef EXFULL
  382.     inscode(d, ds, de, "EXFULL", EXFULL, "Exchange full");
  383. #endif
  384. #ifdef ECONNREFUSED
  385.     inscode(d, ds, de, "ECONNREFUSED", ECONNREFUSED, "Connection refused");
  386. #else
  387. #ifdef WSAECONNREFUSED
  388.     inscode(d, ds, de, "ECONNREFUSED", WSAECONNREFUSED, "Connection refused");
  389. #endif
  390. #endif
  391. #ifdef EISDIR
  392.     inscode(d, ds, de, "EISDIR", EISDIR, "Is a directory");
  393. #endif
  394. #ifdef EPROTONOSUPPORT
  395.     inscode(d, ds, de, "EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported");
  396. #else
  397. #ifdef WSAEPROTONOSUPPORT
  398.     inscode(d, ds, de, "EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
  399. #endif
  400. #endif
  401. #ifdef EROFS
  402.     inscode(d, ds, de, "EROFS", EROFS, "Read-only file system");
  403. #endif
  404. #ifdef EADDRNOTAVAIL
  405.     inscode(d, ds, de, "EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address");
  406. #else
  407. #ifdef WSAEADDRNOTAVAIL
  408.     inscode(d, ds, de, "EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
  409. #endif
  410. #endif
  411. #ifdef EIDRM
  412.     inscode(d, ds, de, "EIDRM", EIDRM, "Identifier removed");
  413. #endif
  414. #ifdef ECOMM
  415.     inscode(d, ds, de, "ECOMM", ECOMM, "Communication error on send");
  416. #endif
  417. #ifdef ESRMNT
  418.     inscode(d, ds, de, "ESRMNT", ESRMNT, "Srmount error");
  419. #endif
  420. #ifdef EREMOTEIO
  421.     inscode(d, ds, de, "EREMOTEIO", EREMOTEIO, "Remote I/O error");
  422. #endif
  423. #ifdef EL3RST
  424.     inscode(d, ds, de, "EL3RST", EL3RST, "Level 3 reset");
  425. #endif
  426. #ifdef EBADMSG
  427.     inscode(d, ds, de, "EBADMSG", EBADMSG, "Not a data message");
  428. #endif
  429. #ifdef ENFILE
  430.     inscode(d, ds, de, "ENFILE", ENFILE, "File table overflow");
  431. #endif
  432. #ifdef ELIBMAX
  433.     inscode(d, ds, de, "ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries");
  434. #endif
  435. #ifdef ESPIPE
  436.     inscode(d, ds, de, "ESPIPE", ESPIPE, "Illegal seek");
  437. #endif
  438. #ifdef ENOLINK
  439.     inscode(d, ds, de, "ENOLINK", ENOLINK, "Link has been severed");
  440. #endif
  441. #ifdef ENETRESET
  442.     inscode(d, ds, de, "ENETRESET", ENETRESET, "Network dropped connection because of reset");
  443. #else
  444. #ifdef WSAENETRESET
  445.     inscode(d, ds, de, "ENETRESET", WSAENETRESET, "Network dropped connection because of reset");
  446. #endif
  447. #endif
  448. #ifdef ETIMEDOUT
  449.     inscode(d, ds, de, "ETIMEDOUT", ETIMEDOUT, "Connection timed out");
  450. #else
  451. #ifdef WSAETIMEDOUT
  452.     inscode(d, ds, de, "ETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
  453. #endif
  454. #endif
  455. #ifdef ENOENT
  456.     inscode(d, ds, de, "ENOENT", ENOENT, "No such file or directory");
  457. #endif
  458. #ifdef EEXIST
  459.     inscode(d, ds, de, "EEXIST", EEXIST, "File exists");
  460. #endif
  461. #ifdef EDQUOT
  462.     inscode(d, ds, de, "EDQUOT", EDQUOT, "Quota exceeded");
  463. #else
  464. #ifdef WSAEDQUOT
  465.     inscode(d, ds, de, "EDQUOT", WSAEDQUOT, "Quota exceeded");
  466. #endif
  467. #endif
  468. #ifdef ENOSTR
  469.     inscode(d, ds, de, "ENOSTR", ENOSTR, "Device not a stream");
  470. #endif
  471. #ifdef EBADSLT
  472.     inscode(d, ds, de, "EBADSLT", EBADSLT, "Invalid slot");
  473. #endif
  474. #ifdef EBADRQC
  475.     inscode(d, ds, de, "EBADRQC", EBADRQC, "Invalid request code");
  476. #endif
  477. #ifdef ELIBACC
  478.     inscode(d, ds, de, "ELIBACC", ELIBACC, "Can not access a needed shared library");
  479. #endif
  480. #ifdef EFAULT
  481.     inscode(d, ds, de, "EFAULT", EFAULT, "Bad address");
  482. #else
  483. #ifdef WSAEFAULT
  484.     inscode(d, ds, de, "EFAULT", WSAEFAULT, "Bad address");
  485. #endif
  486. #endif
  487. #ifdef EFBIG
  488.     inscode(d, ds, de, "EFBIG", EFBIG, "File too large");
  489. #endif
  490. #ifdef EDEADLK
  491.     inscode(d, ds, de, "EDEADLK", EDEADLK, "Resource deadlock would occur");
  492. #endif
  493. #ifdef ENOTCONN
  494.     inscode(d, ds, de, "ENOTCONN", ENOTCONN, "Transport endpoint is not connected");
  495. #else
  496. #ifdef WSAENOTCONN
  497.     inscode(d, ds, de, "ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
  498. #endif
  499. #endif
  500. #ifdef EDESTADDRREQ
  501.     inscode(d, ds, de, "EDESTADDRREQ", EDESTADDRREQ, "Destination address required");
  502. #else
  503. #ifdef WSAEDESTADDRREQ
  504.     inscode(d, ds, de, "EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
  505. #endif
  506. #endif
  507. #ifdef ELIBSCN
  508.     inscode(d, ds, de, "ELIBSCN", ELIBSCN, ".lib section in a.out corrupted");
  509. #endif
  510. #ifdef ENOLCK
  511.     inscode(d, ds, de, "ENOLCK", ENOLCK, "No record locks available");
  512. #endif
  513. #ifdef EISNAM
  514.     inscode(d, ds, de, "EISNAM", EISNAM, "Is a named type file");
  515. #endif
  516. #ifdef ECONNABORTED
  517.     inscode(d, ds, de, "ECONNABORTED", ECONNABORTED, "Software caused connection abort");
  518. #else
  519. #ifdef WSAECONNABORTED
  520.     inscode(d, ds, de, "ECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
  521. #endif
  522. #endif
  523. #ifdef ENETUNREACH
  524.     inscode(d, ds, de, "ENETUNREACH", ENETUNREACH, "Network is unreachable");
  525. #else
  526. #ifdef WSAENETUNREACH
  527.     inscode(d, ds, de, "ENETUNREACH", WSAENETUNREACH, "Network is unreachable");
  528. #endif
  529. #endif
  530. #ifdef ESTALE
  531.     inscode(d, ds, de, "ESTALE", ESTALE, "Stale NFS file handle");
  532. #else
  533. #ifdef WSAESTALE
  534.     inscode(d, ds, de, "ESTALE", WSAESTALE, "Stale NFS file handle");
  535. #endif
  536. #endif
  537. #ifdef ENOSR
  538.     inscode(d, ds, de, "ENOSR", ENOSR, "Out of streams resources");
  539. #endif
  540. #ifdef ENOMEM
  541.     inscode(d, ds, de, "ENOMEM", ENOMEM, "Out of memory");
  542. #endif
  543. #ifdef ENOTSOCK
  544.     inscode(d, ds, de, "ENOTSOCK", ENOTSOCK, "Socket operation on non-socket");
  545. #else
  546. #ifdef WSAENOTSOCK
  547.     inscode(d, ds, de, "ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
  548. #endif
  549. #endif
  550. #ifdef ESTRPIPE
  551.     inscode(d, ds, de, "ESTRPIPE", ESTRPIPE, "Streams pipe error");
  552. #endif
  553. #ifdef EMLINK
  554.     inscode(d, ds, de, "EMLINK", EMLINK, "Too many links");
  555. #endif
  556. #ifdef ERANGE
  557.     inscode(d, ds, de, "ERANGE", ERANGE, "Math result not representable");
  558. #endif
  559. #ifdef ELIBEXEC
  560.     inscode(d, ds, de, "ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly");
  561. #endif
  562. #ifdef EL3HLT
  563.     inscode(d, ds, de, "EL3HLT", EL3HLT, "Level 3 halted");
  564. #endif
  565. #ifdef ECONNRESET
  566.     inscode(d, ds, de, "ECONNRESET", ECONNRESET, "Connection reset by peer");
  567. #else
  568. #ifdef WSAECONNRESET
  569.     inscode(d, ds, de, "ECONNRESET", WSAECONNRESET, "Connection reset by peer");
  570. #endif
  571. #endif
  572. #ifdef EADDRINUSE
  573.     inscode(d, ds, de, "EADDRINUSE", EADDRINUSE, "Address already in use");
  574. #else
  575. #ifdef WSAEADDRINUSE
  576.     inscode(d, ds, de, "EADDRINUSE", WSAEADDRINUSE, "Address already in use");
  577. #endif
  578. #endif
  579. #ifdef EOPNOTSUPP
  580.     inscode(d, ds, de, "EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint");
  581. #else
  582. #ifdef WSAEOPNOTSUPP
  583.     inscode(d, ds, de, "EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
  584. #endif
  585. #endif
  586. #ifdef EREMCHG
  587.     inscode(d, ds, de, "EREMCHG", EREMCHG, "Remote address changed");
  588. #endif
  589. #ifdef EAGAIN
  590.     inscode(d, ds, de, "EAGAIN", EAGAIN, "Try again");
  591. #endif
  592. #ifdef ENAMETOOLONG
  593.     inscode(d, ds, de, "ENAMETOOLONG", ENAMETOOLONG, "File name too long");
  594. #else
  595. #ifdef WSAENAMETOOLONG
  596.     inscode(d, ds, de, "ENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
  597. #endif
  598. #endif
  599. #ifdef ENOTTY
  600.     inscode(d, ds, de, "ENOTTY", ENOTTY, "Not a typewriter");
  601. #endif
  602. #ifdef ERESTART
  603.     inscode(d, ds, de, "ERESTART", ERESTART, "Interrupted system call should be restarted");
  604. #endif
  605. #ifdef ESOCKTNOSUPPORT
  606.     inscode(d, ds, de, "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported");
  607. #else
  608. #ifdef WSAESOCKTNOSUPPORT
  609.     inscode(d, ds, de, "ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
  610. #endif
  611. #endif
  612. #ifdef ETIME
  613.     inscode(d, ds, de, "ETIME", ETIME, "Timer expired");
  614. #endif
  615. #ifdef EBFONT
  616.     inscode(d, ds, de, "EBFONT", EBFONT, "Bad font file format");
  617. #endif
  618. #ifdef EDEADLOCK
  619.     inscode(d, ds, de, "EDEADLOCK", EDEADLOCK, "Error EDEADLOCK");
  620. #endif
  621. #ifdef ETOOMANYREFS
  622.     inscode(d, ds, de, "ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice");
  623. #else
  624. #ifdef WSAETOOMANYREFS
  625.     inscode(d, ds, de, "ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
  626. #endif
  627. #endif
  628. #ifdef EMFILE
  629.     inscode(d, ds, de, "EMFILE", EMFILE, "Too many open files");
  630. #else
  631. #ifdef WSAEMFILE
  632.     inscode(d, ds, de, "EMFILE", WSAEMFILE, "Too many open files");
  633. #endif
  634. #endif
  635. #ifdef ETXTBSY
  636.     inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy");
  637. #endif
  638. #ifdef EINPROGRESS
  639.     inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress");
  640. #else
  641. #ifdef WSAEINPROGRESS
  642.     inscode(d, ds, de, "EINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
  643. #endif
  644. #endif
  645. #ifdef ENXIO
  646.     inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address");
  647. #endif
  648. #ifdef ENOPKG
  649.     inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
  650. #endif
  651. #ifdef WSASY
  652.     inscode(d, ds, de, "WSASY", WSASY, "Error WSASY");
  653. #endif
  654. #ifdef WSAEHOSTDOWN
  655.     inscode(d, ds, de, "WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down");
  656. #endif
  657. #ifdef WSAENETDOWN
  658.     inscode(d, ds, de, "WSAENETDOWN", WSAENETDOWN, "Network is down");
  659. #endif
  660. #ifdef WSAENOTSOCK
  661.     inscode(d, ds, de, "WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
  662. #endif
  663. #ifdef WSAEHOSTUNREACH
  664.     inscode(d, ds, de, "WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
  665. #endif
  666. #ifdef WSAELOOP
  667.     inscode(d, ds, de, "WSAELOOP", WSAELOOP, "Too many symbolic links encountered");
  668. #endif
  669. #ifdef WSAEMFILE
  670.     inscode(d, ds, de, "WSAEMFILE", WSAEMFILE, "Too many open files");
  671. #endif
  672. #ifdef WSAESTALE
  673.     inscode(d, ds, de, "WSAESTALE", WSAESTALE, "Stale NFS file handle");
  674. #endif
  675. #ifdef WSAVERNOTSUPPORTED
  676.     inscode(d, ds, de, "WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED");
  677. #endif
  678. #ifdef WSAENETUNREACH
  679.     inscode(d, ds, de, "WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable");
  680. #endif
  681. #ifdef WSAEPROCLIM
  682.     inscode(d, ds, de, "WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM");
  683. #endif
  684. #ifdef WSAEFAULT
  685.     inscode(d, ds, de, "WSAEFAULT", WSAEFAULT, "Bad address");
  686. #endif
  687. #ifdef WSANOTINITIALISED
  688.     inscode(d, ds, de, "WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED");
  689. #endif
  690. #ifdef WSAEUSERS
  691.     inscode(d, ds, de, "WSAEUSERS", WSAEUSERS, "Too many users");
  692. #endif
  693. #ifdef WSAMAKEASYNCREPL
  694.     inscode(d, ds, de, "WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL");
  695. #endif
  696. #ifdef WSAENOPROTOOPT
  697.     inscode(d, ds, de, "WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
  698. #endif
  699. #ifdef WSAECONNABORTED
  700.     inscode(d, ds, de, "WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
  701. #endif
  702. #ifdef WSAENAMETOOLONG
  703.     inscode(d, ds, de, "WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
  704. #endif
  705. #ifdef WSAENOTEMPTY
  706.     inscode(d, ds, de, "WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
  707. #endif
  708. #ifdef WSAESHUTDOWN
  709.     inscode(d, ds, de, "WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
  710. #endif
  711. #ifdef WSAEAFNOSUPPORT
  712.     inscode(d, ds, de, "WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
  713. #endif
  714. #ifdef WSAETOOMANYREFS
  715.     inscode(d, ds, de, "WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
  716. #endif
  717. #ifdef WSAEACCES
  718.     inscode(d, ds, de, "WSAEACCES", WSAEACCES, "Permission denied");
  719. #endif
  720. #ifdef WSATR
  721.     inscode(d, ds, de, "WSATR", WSATR, "Error WSATR");
  722. #endif
  723. #ifdef WSABASEERR
  724.     inscode(d, ds, de, "WSABASEERR", WSABASEERR, "Error WSABASEERR");
  725. #endif
  726. #ifdef WSADESCRIPTIO
  727.     inscode(d, ds, de, "WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO");
  728. #endif
  729. #ifdef WSAEMSGSIZE
  730.     inscode(d, ds, de, "WSAEMSGSIZE", WSAEMSGSIZE, "Message too long");
  731. #endif
  732. #ifdef WSAEBADF
  733.     inscode(d, ds, de, "WSAEBADF", WSAEBADF, "Bad file number");
  734. #endif
  735. #ifdef WSAECONNRESET
  736.     inscode(d, ds, de, "WSAECONNRESET", WSAECONNRESET, "Connection reset by peer");
  737. #endif
  738. #ifdef WSAGETSELECTERRO
  739.     inscode(d, ds, de, "WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO");
  740. #endif
  741. #ifdef WSAETIMEDOUT
  742.     inscode(d, ds, de, "WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
  743. #endif
  744. #ifdef WSAENOBUFS
  745.     inscode(d, ds, de, "WSAENOBUFS", WSAENOBUFS, "No buffer space available");
  746. #endif
  747. #ifdef WSAEDISCON
  748.     inscode(d, ds, de, "WSAEDISCON", WSAEDISCON, "Error WSAEDISCON");
  749. #endif
  750. #ifdef WSAEINTR
  751.     inscode(d, ds, de, "WSAEINTR", WSAEINTR, "Interrupted system call");
  752. #endif
  753. #ifdef WSAEPROTOTYPE
  754.     inscode(d, ds, de, "WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
  755. #endif
  756. #ifdef WSAHOS
  757.     inscode(d, ds, de, "WSAHOS", WSAHOS, "Error WSAHOS");
  758. #endif
  759. #ifdef WSAEADDRINUSE
  760.     inscode(d, ds, de, "WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use");
  761. #endif
  762. #ifdef WSAEADDRNOTAVAIL
  763.     inscode(d, ds, de, "WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
  764. #endif
  765. #ifdef WSAEALREADY
  766.     inscode(d, ds, de, "WSAEALREADY", WSAEALREADY, "Operation already in progress");
  767. #endif
  768. #ifdef WSAEPROTONOSUPPORT
  769.     inscode(d, ds, de, "WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
  770. #endif
  771. #ifdef WSASYSNOTREADY
  772.     inscode(d, ds, de, "WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY");
  773. #endif
  774. #ifdef WSAEWOULDBLOCK
  775.     inscode(d, ds, de, "WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
  776. #endif
  777. #ifdef WSAEPFNOSUPPORT
  778.     inscode(d, ds, de, "WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
  779. #endif
  780. #ifdef WSAEOPNOTSUPP
  781.     inscode(d, ds, de, "WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
  782. #endif
  783. #ifdef WSAEISCONN
  784.     inscode(d, ds, de, "WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected");
  785. #endif
  786. #ifdef WSAEDQUOT
  787.     inscode(d, ds, de, "WSAEDQUOT", WSAEDQUOT, "Quota exceeded");
  788. #endif
  789. #ifdef WSAENOTCONN
  790.     inscode(d, ds, de, "WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
  791. #endif
  792. #ifdef WSAEREMOTE
  793.     inscode(d, ds, de, "WSAEREMOTE", WSAEREMOTE, "Object is remote");
  794. #endif
  795. #ifdef WSAEINVAL
  796.     inscode(d, ds, de, "WSAEINVAL", WSAEINVAL, "Invalid argument");
  797. #endif
  798. #ifdef WSAEINPROGRESS
  799.     inscode(d, ds, de, "WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
  800. #endif
  801. #ifdef WSAGETSELECTEVEN
  802.     inscode(d, ds, de, "WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN");
  803. #endif
  804. #ifdef WSAESOCKTNOSUPPORT
  805.     inscode(d, ds, de, "WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
  806. #endif
  807. #ifdef WSAGETASYNCERRO
  808.     inscode(d, ds, de, "WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO");
  809. #endif
  810. #ifdef WSAMAKESELECTREPL
  811.     inscode(d, ds, de, "WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL");
  812. #endif
  813. #ifdef WSAGETASYNCBUFLE
  814.     inscode(d, ds, de, "WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE");
  815. #endif
  816. #ifdef WSAEDESTADDRREQ
  817.     inscode(d, ds, de, "WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
  818. #endif
  819. #ifdef WSAECONNREFUSED
  820.     inscode(d, ds, de, "WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused");
  821. #endif
  822. #ifdef WSAENETRESET
  823.     inscode(d, ds, de, "WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset");
  824. #endif
  825. #ifdef WSAN
  826.     inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
  827. #endif
  828.  
  829.     Py_DECREF(de);
  830. }
  831.